package demo3;

public class Computer {
    public void close(){
        System.out.println("关闭电脑......");
    }
    public void open(){
        System.out.println("打开电脑......");
    }
    public void useDevices(IUSB iusb){
        iusb.openDevices();
        iusb.test();
        if(iusb instanceof Mouse){
            Mouse mouse=(Mouse) iusb;
            mouse.click();
        }if(iusb instanceof KeyBoard){
            KeyBoard keyBoard=(KeyBoard) iusb;
            keyBoard.input();
        }
        iusb.closeDevices();
    }



}
